﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using mal.balades.Business.DataModel;
using mal.balades.Business.Web;

namespace mal.balades.Web.Controls
{
    public partial class CategoryPictureControl : System.Web.UI.UserControl
    {
        #region Fields

        #endregion

        #region Construction / Destruction

        #endregion

        #region enum, struct, class

        #endregion

        #region Properties
        public Category Category { get; set; }
        public int? Width { get; set; }
        #endregion

        #region Methods

        #endregion

        #region Events
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Category == null)
                this.Visible = false;
            else
            {
                this.picture.ImageUrl = UrlManager.CategoryPictureUrl(this.Category.Image);
                if (this.Width.HasValue)
                    this.picture.Width = new Unit(Width.Value);
                

                this.link.NavigateUrl = UrlManager.CategoryUrl(this.Category.UrlName);
                this.link.ToolTip = this.Category.Name;
            }

        }
        #endregion

    }
}